package com.corn.flink.lesson2;

import org.apache.flink.api.common.RuntimeExecutionMode;
import org.apache.flink.streaming.api.environment.LocalStreamEnvironment;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

/**
 * @author : Jim Wu
 * @version 1.0
 * @function :
 * @since : 2023/2/22 11:02
 */

public class FlinkEnvDemo {

    public static void main(String[] args) {
        // 自适应创建环境 flink会自动分析运行环境创建不同的Environment 会常用的方式
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        // 创建本地环境
        LocalStreamEnvironment localEnv = StreamExecutionEnvironment.createLocalEnvironment();
        // 创建远程执行环境
        // job manager host
        String host = "node1";
        // job manager port
        int port = 6123;
        // 默认并行度
        int parallelism = 1;
        // jar包存在位置
        String jarFiles = "hdfs://flink/data/wordCount.class";
        StreamExecutionEnvironment remoteEnv = StreamExecutionEnvironment.createRemoteEnvironment(host, port, parallelism, jarFiles);
    }
}
